package com.wanxin.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;

/**
 * @author common
 */

@RestController
@RequestMapping("userController")
public class UserController {
    /**
     * @return
     * 声明单元方法：用户删除
     */
    @RequiresPermissions("user:del")
    @RequestMapping("userDel")
    public String userDel(){
        System.out.println("用户信息删除成功");
        return "成功删除";
    }


    /**
     * @return
     * 声明单元方法：用户修改
     */
    @RequiresPermissions("user:edit")
    @RequestMapping("userEdit")
    public String userEdit(){
        System.out.println("用户信息修改成功");
        return "成功修改";
    }


    /**
     * @return
     * 声明单元方法：用户新增
     */
    @RequiresRoles("学生")
    @RequiresPermissions("user:add")
    @RequestMapping("userAdd")
    public String userAdd(){
        System.out.println("用户信息新增成功");
        return "成功新增";
    }


    /**
     * @return
     * 声明单元方法：用户查询
     */
    @RequiresRoles("学生")
    @RequiresPermissions("user:sel")
    @RequestMapping("userSel")
    public String userSel(){
        System.out.println("用户信息查询成功");
        return "成功查询";
    }


    @GetMapping("usersave/{page}/{size}")
    @ResponseBody
    public String userSAVE(@PathVariable("page") Integer page,@PathVariable("size") Integer size){
        return "如果登入成功则说明shiro登入是全局的"+page+size;
    }

}
